package front.membr.model;

import java.util.List;
import java.util.Set;

import com.likelist.model.Like_listVO;
public class MemService  {

	private MemDAO_interface dao;
	
	public MemService(){
		dao = new MemDAO();
	}
	
	
	
	public MemVO addMem( String maccount,String mname, String mpassword,
                       String sex, java.sql.Date mbirthday, String memail, String mphonetel,
                       String mhometel, Integer vatno, String title, String city,
                       String town, String route, Integer zcode, Integer birthmony) {
		MemVO memVO = new MemVO();
		
		memVO.setMaccount(maccount);
		memVO.setMname(mname);
		memVO.setMpassword(mpassword);
		memVO.setSex(sex);
		memVO.setMbirthday(mbirthday);
		memVO.setMemail(memail);
		memVO.setMphonetel(mphonetel);
		memVO.setMhometel(mhometel);
		memVO.setVatno(vatno);
		memVO.setTitle(title);
		memVO.setCity(city);
		memVO.setTown(town);
		memVO.setRoute(route);
		memVO.setZcode(zcode);
		memVO.setBirthmony(birthmony);
		dao.insert(memVO);
		
		return memVO;
	}

	
	public MemVO updateMem( String maccount,String mname, String mpassword,
            String sex, java.sql.Date mbirthday, String memail, String mphonetel,
            String mhometel, Integer vatno, String title, String city,
            String town, String route, Integer zcode) {
         MemVO memVO = new MemVO();

               memVO.setMaccount(maccount);
               memVO.setMname(mname);
               memVO.setMpassword(mpassword);
               memVO.setSex(sex);
               memVO.setMbirthday(mbirthday);
               memVO.setMemail(memail);
               memVO.setMphonetel(mphonetel);
               memVO.setMhometel(mhometel);
               memVO.setVatno(vatno);
               memVO.setTitle(title);
               memVO.setCity(city);
               memVO.setTown(town);
               memVO.setRoute(route);
               memVO.setZcode(zcode);
               dao.update(memVO);

            return memVO;
   }

	
	public void deleteMem(String maccount) {
		dao.delete(maccount);
		
	}

	
	public MemVO getOneMem(String maccount) {
		
		return dao.findByPrimaryKey(maccount);
	}

	
	public List<MemVO> getAll() {
		return dao.getAll();
	}

	public Set<Like_listVO> getLikeListByMaccount(String maccount) {
		return dao.getLikeList(maccount);
	}

	
	
	
	
	

}
